typedef struct stack_element
{
	struct stack_element *prev;
	int state;
}STACK;

STACK *add_to_stack(STACK *stack, int state){
    STACK *nstack = (STACK *)malloc(sizeof(STACK));
    if(nstack == NULL)
        return (NULL);
    nstack->state = state;
    nstack->prev = stack;
    return(nstack);
}

STACK *pop_stack(STACK *stack){
    STACK *tmp = stack->prev;
    free(stack);
    return(tmp);
}
